home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / plan / src / conf.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  8KB  |  196 lines

  1. /*
  2.  * definitions common to the main program and the daemon. It excludes all
  3.  * X and motif stuff.
  4.  */
  5.  
  6. #define DB_FILE        ".dayplan"        /* public file name, no path */
  7. #define DB_PUB_PATH    "~/.dayplan"        /* public appts & config */
  8. #define DB_PRIV_PATH    "~/.dayplan.priv"    /* private appointments */
  9. #define HOLIDAY_PATH    "~/.holiday"        /* holiday database */
  10. #define HOLIDAY_NAME    "holiday"        /* global holiday dbase (LIB)*/
  11. #define LOCK_PATH    "/tmp/.pland%d"    /* daemon lock/pid file, %d is uid */
  12. #define PLAN_PATH    "/tmp/.plan%d"    /* plan lock/pid file, %d is uid */
  13. #define HELP_FN        "plan.help"    /* help text file */
  14. #define DAEMON_FN    "pland"        /* daemon program */
  15. #define ALARM_FN    "notifier"    /* program that shows alarm popup. */
  16.                     /* the directoy is taken from the */
  17.                     /* daemon's argv[0] */
  18. #define PS_SPOOLER    "lp"
  19.  
  20. #if defined(XlibSpecificationRelease) && defined(sgi)
  21. #include <X11/Xmu/Editres.h>
  22. #define EDITRES
  23. #endif
  24. #ifndef _XEditResCheckMessages
  25. #undef  EDITRES
  26. #endif
  27.  
  28. #ifndef PID_T
  29. #define PID_T        pid_t        /* from types.h, see -DPID_T */
  30. #endif
  31.  
  32. #define BOOL int
  33. #define TRUE 1
  34. #define FALSE 0
  35.  
  36. #define TIMER_PERIOD    10*1000        /* autosave and recycle period [ms] */
  37. #define MAXT        0x7fffffff    /* highest possible time_t value */
  38. #define ANCIENT        3*60        /* ignore triggers older than this */
  39. #ifdef BSD
  40. #define HIBERNATE    5*60        /* if no alarm in sight, sleep <5 min*/
  41. #else
  42. #define HIBERNATE    60*60        /* if no alarm in sight, sleep <1 h */
  43. #endif
  44. #define EON        631152000    /* ignore schedule entries before */
  45.                     /* this date (sometime early 1990) */
  46.  
  47. #define TIME(t)        ((t)%86400)    /* extract time-of-day from date/time*/
  48. #define DATE(t)        ((t)/86400)    /* extract date from date/time */
  49.  
  50.  
  51. struct config {            /* global configuration data */
  52.     time_t        tzone;        /* timezone with dst figured in */
  53.     BOOL        showicontime;    /* print time into icontitle if nz */
  54.     BOOL        noicon;        /* don't draw anything into the icon */
  55.     BOOL        frame_today;    /* draw black frame into today's box */
  56.     BOOL        sgimode;    /* use SGI desktop style */
  57.     BOOL        smallmonth;    /* large or small month menu? */
  58.  
  59.     BOOL        sunday_first;    /* TRUE for US style, else European */
  60.     BOOL        ampm;        /* TRUE for US style, else European */
  61.     BOOL        mmddyy;        /* TRUE for m/d/y, FALSE for d.m.y */
  62.     BOOL        autodel;    /* TRUE deletes old entries after 24h*/
  63.     BOOL        julian;        /* TRUE prints julian dates */
  64.     BOOL        weeknum;    /* TRUE prints week numbers */
  65.     BOOL        nopast;        /* TRUE skips todays past daybox notes*/
  66.     BOOL        bigwarning;    /* TRUE shows wide adv-warning column*/
  67.     BOOL        weekwarn;    /* TRUE shows warnings in week view */
  68.     BOOL        weekuser;    /* TRUE shows user names in week bars*/
  69.  
  70.     time_t        adjust_time;    /* correction constant for sys clock */
  71.     time_t        raw_tzone;    /* tzone dst NOT figured in */
  72.     int        dst_flag;    /* 0=dst on, 1=dst off, 2=begin..end */
  73.     int        dst_begin;    /* if dst_flag==2, first dst day */
  74.     int        dst_end;    /* if dst_flag==2, last dst day */
  75.     int        dst_begin_time;    /* time of day dst_begin */
  76.     int        dst_end_time;    /* time of day dst_end */
  77.  
  78.     int        early_time;    /* default # of secs for early warn */
  79.     int        late_time;    /* default # of secs for late warn */
  80.  
  81.     int        calbox_xs[2];    /* main window: width of one day */
  82.     int        calbox_ys[2];    /* main window: height of one day */
  83.     int        calbox_marg[2];    /* main window: margin all around */
  84.     int        calbox_arrow[2];/* main window: arrow column width */
  85.     int        calbox_title[2];/* main window: height of wkday row */
  86.  
  87.     int        year_margin;    /* year window: margin all around */
  88.     int        year_gap;    /* year window: gap between months */
  89.     int        year_title;    /* year window: title line height */
  90.     int        yearbox_xs;    /* year window: day box width */
  91.     int        yearbox_ys;    /* year window: day box height */
  92.  
  93.     int        week_minhour;    /* week window: leftmost hour (8) */
  94.     int        week_maxhour;    /* week window: rightmost hour (24) */
  95.     int        week_margin;    /* week window: margin all around */
  96.     int        week_gap;    /* week window: gap around day boxes */
  97.     int        week_title;    /* week window: title line height */
  98.     int        week_hour;    /* week window: hour column height */
  99.     int        week_daywidth;    /* week window: weekday title width */
  100.     int        week_hourwidth;    /* week window: weekday title width */
  101.     int        week_barheight;    /* week window: height of appt bar */
  102.     int        week_bargap;    /* week window: gap above/below bar */
  103.     int        week_maxnote;    /* week window: max length of note */
  104.  
  105.     BOOL        ewarn_window;    /* TRUE: popup window if early warn */
  106.     BOOL        ewarn_mail;    /* TRUE: send mail if early warn */
  107.     BOOL        ewarn_exec;    /* TRUE: exec program if early warn */
  108.     BOOL        lwarn_window;    /* TRUE: popup window if late warn */
  109.     BOOL        lwarn_mail;    /* TRUE: send mail if late warn */
  110.     BOOL        lwarn_exec;    /* TRUE: exec program if late warn */
  111.     BOOL        alarm_window;    /* TRUE: popup window if alarm time */
  112.     BOOL        alarm_mail;    /* TRUE: send mail if alarm time */
  113.     BOOL        alarm_exec;    /* TRUE: exec program if alarm time */
  114.     char        *ewarn_prog;    /* program to exec at early warn time*/
  115.     char        *lwarn_prog;    /* program to exec at late warn time */
  116.     char        *alarm_prog;    /* program to exec at alarm time */
  117.     char        *mailer;    /* mail command, %s is predef subject*/
  118.     time_t        wintimeout;    /* max lifetime of notifiers */
  119. };
  120.  
  121. struct entry {            /* one day-schedule entry */
  122.     long        nextrep;    /* nxt repeating entry in chain or -1*/
  123.     char        *message;    /* message text, 0 if none */
  124.     char        *script;    /* shell script, 0 if none */
  125.     char        *meeting;    /* comma-sep list of meeting members */
  126.     char        *note;        /* explicit short note, 0 if none */
  127.     time_t        time;        /* time and date in seconds */
  128.     time_t        length;        /* length in seconds */
  129.     time_t        early_warn;    /* warn this many seconds in advance */
  130.     time_t        late_warn;    /* and this many seconds, too */
  131.     time_t        rep_every;    /* repeat every N days (in seconds) */
  132.     time_t        rep_last;    /* stop repeating on this date (secs)*/
  133.     long        rep_weekdays;    /* weekday bitmap, bit 0=mon..6=sun */
  134.                     /* bit 8=1st..12=5th, 13=last week */
  135.     long        rep_days;    /* day bitmap, bit 0=last, 1..31=days*/
  136.     BOOL        rep_yearly;    /* repeat every year on the same date*/
  137.     BOOL        suspended;    /* not active, green radio button off*/
  138.     BOOL        private;    /* not accessible for others */
  139.     BOOL        noalarm;    /* no alarm, just warnings if enabled*/
  140.     BOOL        notime;        /* no time is printed in day lists */
  141.     char        triggered;    /* 0=none, 1=early, 2=late, 3=time */
  142. };
  143.  
  144.  
  145. struct list {            /* list of entries */
  146.     BOOL        modified;    /* TRUE if modified */
  147.     BOOL        locked;        /* prevents writefile while changing */
  148.     long        nentries;    /* # of valid entries in list */
  149.     long        size;        /* # of entries allocated */
  150.     long        repeating;    /* first repeating entry, -1 if none */
  151.     struct entry    entry[1];    /* first entry. The list is allocated*/
  152. };                    /* with space for <size> entries.*/
  153.  
  154.                 /* subset of list, points into struct list */
  155. struct sublist {            /* list of entries */
  156.     long        nentries;    /* # of valid entries in list */
  157.     long        size;        /* # of entries allocated */
  158.     struct entry    *entry[1];    /* first entry. The list is allocated*/
  159. };                    /* with space for <size> entries.*/
  160.  
  161.  
  162. /*
  163.  * when we look up an entry, an entry and its trigger time are returned in
  164.  * this struct, which the caller must provide. lookup_entry() also stores
  165.  * other information in this struct that enables lookup_next_entry() to
  166.  * continue the search exactly where lookup_entry() left off.
  167.  */
  168.  
  169. struct lookup {
  170.                     /* the next two are return values */
  171.     long        index;        /* the entry found when looking up */
  172.     time_t        trigger;    /* ... that entry's trigger time */
  173.                     /* the rest is for the next lookup */
  174.     struct list    *list;        /* in which list were we looking */
  175.     long        regindex;    /* last regular entry found */
  176.     time_t        regtime;    /* ... that entry's trigger time */
  177.     long        repindex;    /* last repeating entry found */
  178.     time_t        reptime;    /* ... that entry's trigger time */
  179. };
  180.  
  181.  
  182. /*
  183.  * Information stored about each user in the user list. The user list is
  184.  * an array, because it doesn't change often and it facilitates sorting.
  185.  * Only name, home, suspended, and color are stored in the database file.
  186.  */
  187.  
  188. struct user {
  189.     char        *name;        /* user name */
  190.     char        *home;        /* home directory */
  191.     BOOL        suspended;    /* stored, but ignored */
  192.     int        color;        /* color 0..7 in the week view */
  193.     time_t        time;        /* time when database was read */
  194.     struct list    *list;        /* user's database */
  195. };
  196.